package cn.icyzx.controller;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import static cn.icyzx.util.StaticConstUtil.DEPARTMENT;
import static cn.icyzx.util.StaticConstUtil.INDEX;

/**
 * Created by 郑凯 on 2016/8/13.
 */
@Controller
public class PageProcess {


    /**
     * home index 模板中变量,不带路径的home页面
     *
     * @throws
     */
    @RequestMapping(value = "/", method = RequestMethod.GET)
    String home(Model model) {
        model.addAttribute("active", INDEX);
        return "index";
    }

    /**
     * abooutUs 关于我们页面
     *
     * @throws
     */
    @RequestMapping(value = "/aboutUs", method = RequestMethod.GET)
    public String abooutUs() throws Exception {
        return "aboutUs";
    }

    /**
     * 登录页面
     */
    @RequestMapping(value = "/login", method = RequestMethod.GET)
    public String login() {
        return "login";
    }

    /**
     * department 部门页面
     *
     * @param model 模型变量存储预设值，或者转发过来的值
     * @throws
     */
    @RequestMapping(value = "/department", method = RequestMethod.GET)
    public String department(Model model) {
        model.addAttribute("active", DEPARTMENT);
        return "department";
    }

    /**
     * Recruit 招新页面
     *
     * @param model 模型变量存储预设值，或者转发过来的值
     * @throws
     */
    @RequestMapping(value = "/Recruit", method = RequestMethod.GET)
    public String Recruit(Model model) {
        return "Recruit";
    }


    /**
     * successActive 成功激活页面
     *
     * @param model 模型变量存储预设值，或者转发过来的值
     * @throws
     */
    @RequestMapping(value = "/successActive", method = RequestMethod.GET)
    public String successActive(Model model) {
        return "success";
    }

    /**
     * sendEmailToActivePage 发送邮件页面
     *
     * @param model 模型变量存储预设值，或者转发过来的值
     * @throws
     */
    @RequestMapping(value = "/sendEmail", method = RequestMethod.GET)
    public String sendEmailToActivePage(Model model) {
        model.addAttribute("sendEmailTitle", "发送邮件激活账号");
        model.addAttribute("sendEmailAction", "activeUser");
        return "sendEmail";
    }


}
